home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 151-175 / 169 / src / shell / c.asm next >
Assembly Source File  |  1995-03-13  |  2KB  |  84 lines

  1. ;:ts=8
  2. ; Copyright (C) 1986,1987 by Manx Software Systems, Inc.
  3. ;
  4. ;       Initial startup routine for Aztec C.
  5. ;       NOTE: code down to "start" must be placed at beginning of
  6. ;               all programs linked with Aztec Linker using small
  7. ;               code or small data.
  8.  
  9.         mc68881
  10.         entry   .begin
  11.         public  .begin
  12.  
  13.         FAR code
  14.         FAR data
  15.  
  16. .begin
  17.         move.l  a0,-(sp)
  18.         lea     _SysRegs,a0
  19.         movem.l d0-d7/a0-a6,(a0)
  20.         move.l  (sp)+,a0
  21.         bsr     _geta4                  ;get A4
  22.         lea     __H1_end,a1
  23.         lea     __H2_org,a2
  24.         cmp.l   a1,a2                   ;check if BSS and DATA together
  25.         bne     start                   ;no, don't have to clear
  26.         move.w  #((__H2_end-__H2_org)/4)-1,d1
  27.         bmi     start                   ;skip if no bss
  28.         move.l  #0,d2
  29. loop
  30.         move.l  d2,(a1)+                ;clear out memory
  31.         dbra    d1,loop
  32.  
  33. start
  34.         move.l  sp,__savsp              ;save stack pointer
  35.         move.l  4,a6                    ;get Exec's library base pointer
  36.         move.l  a6,_SysBase             ;put where we can get it
  37.         movem.l d0/a0,-(sp)             ;save CLI command parameters
  38.  
  39.         btst.b  #4,$129(a6)             ;check for 68881 flag in AttnFlags
  40.         beq     x1                      ;skip if not
  41.         lea     x2,a5
  42.         jsr     -30(a6)                 ;do it in supervisor mode
  43.         bra     x1
  44. x2
  45.         clr.l   -(sp)
  46.         frestore (sp)+                  ;reset the ffp stuff
  47.         rte                             ;and return
  48. x1
  49.  
  50.         lea     dos_name,a1             ;get name of dos library
  51.         jsr     -408(a6)                ;open the library any version
  52.         move.l  d0,_DOSBase             ;set it up
  53.         bne     x3                      ;skip if okay
  54.  
  55.         move.l  #$38007,d7              ;AG_OpenLib | AO_DOSLib
  56.         jsr     -108(a6)                ;Alert
  57.         bra     x4
  58. x3
  59.         jsr     __main                  ;call the startup stuff
  60. x4
  61.         add.w   #8,sp                   ;pop args
  62.         rts                             ;and return
  63.  
  64. dos_name:
  65.         dc.b    'dos.library',0
  66.  
  67.         public  _geta4
  68.  
  69. _geta4:
  70.         far     data
  71.         lea     __H1_org+32766,a4
  72.         rts
  73.  
  74.         public  __main,__H0_org
  75.  
  76.         dseg
  77.  
  78.         public  _SysRegs
  79.         public  _SysBase,__savsp,_DOSBase
  80.         public  __H1_org,__H1_end,__H2_org,__H2_end
  81.  
  82.  
  83.  
  84.